<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>超时订单管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="resources/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="resources/css/public.css" media="all"/>
</head>
<body class="childrenBody">
<form class="layui-form">
    <blockquote class="layui-elem-quote quoteBox">
        <form class="layui-form">
            <div class="layui-inline">
                <div class="layui-input-inline">
                    订单编号：<input type="text" class="layui-input numVal" placeholder="请输入订单编号"/>
                </div>
                <div class="layui-input-inline">
                    用户名称：<input type="text" class="layui-input nameVal" placeholder="请输入用户名称"/>
                </div>
                <div class="layui-input-inline">
                    车位位置：<input type="text" class="layui-input locationVal" placeholder="请输入车位位置"/>
                </div>
                <div class="layui-input-inline">
                    下单日期：<input type="text" class="layui-input createVal" placeholder="请输入订单生成日期"/>
                </div>
                <a class="layui-btn search_btn" data-type="reload">搜索</a>
            </div>
        </form>
    </blockquote>
    <table id="overtable" lay-filter="overtable"></table>
    <!--操作-->
    <script type="text/html" id="overDealBar">
        <a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="detail">详情</a>
    </script>
</form>
<script type="text/javascript" src="resources/layui/layui.js"></script>
<script type="text/javascript" th:inline="none">
    layui.use(['form', 'layer', 'table', 'laytpl'], function () {
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery,
            laytpl = layui.laytpl,
            table = layui.table;
        //用户列表
        var tableIns = table.render({
            elem: '#overtable',
            url: 'overOrderSelectByPage.do',
            cellMinWidth: 95,
            page: true,
            height: "full-200",
            limits: [10, 15, 20, 25],
            limit: 10,
            id: "overtablezz",
            cols: [[
                {type: "checkbox", fixed: "left", width: 50},
                {field: 'id', title: '序列号', minWidth: 100, align: "center"},
                {field: 'num', title: '订单编号', minWidth: 200, align: "center"},
                {field: 'name', title: '用户名称', align: 'center'},
                {field: 'overPrice', title: '超时单价', align: 'center'},
                {field: 'totalPrice', title: '超时总价', align: 'center'},
                {field: 'orderId', title: '预订单id', align: 'center'},

                {field: 'location', title: '预约车位位置', align: 'center'},
                {
                    field: 'createTime', title: '订单生成日期', align: 'center', minWidth: 90, templet: function (obj) {
                        return obj.createTime;
                    }
                },
                {
                    field: 'startTime', title: '超时开始日期', align: 'center', minWidth: 90, templet: function (obj) {
                        return obj.startTime;
                    }
                },
                {
                    field: 'leaveTime', title: '超时结束日期', align: 'center', minWidth: 90, templet: function (obj) {
                        return obj.leaveTime;
                    }
                },
                {field: 'status', title: '订单状态', align: 'center'},
                {title: '操作', templet: '#overDealBar', fixed: "right", align: "center"}
            ]],
            done: function () {
                $("[data-field='overPrice']").css('display','none');
                $("[data-field='totalPrice']").css('display','none');
                $("[data-field='orderId']").css('display','none');
            }
        });
        //实现搜索功能
        $(".search_btn").click(function () {
            var num = $(".numVal").val();
            var name=$(".nameVal").val();
            var location=$(".locationVal").val();
            var createTime=$(".createVal").val();
            table.reload('overtablezz', {
                where: {
                    num:num,
                    name:name,
                    location:location,
                    createTime:createTime
                }
            });
        });

        table.on("tool(overtable)", function (obj) {
            // console.log(data.link_cust_no);
            //获取当前行的数据
            var data = obj.data;
            switch (obj.event) {
                case 'detail':
                    lookComm(data);
                    break;
            }
        });

        //进入详情页面的弹出框
        function lookComm(data) {
            var index = layui.layer.open({
                title: "超时订单详情",
                type: 2,
                content: "toOverOrderDetails.do",
                area: ['650px', '600px'],
                success: function (layero, index) {
                    var body = layui.layer.getChildFrame('body', index);//少了这个是不能从父页面向子页面传值的
                    body.contents().find("#serviceIdHiden1").val(data.orderId);//这样就将值传递给子页面中id为serviceIdHiden的隐藏域
                    body.contents().find(".startTime").val(data.startTime);
                    body.contents().find(".leaveTime").val(data.leaveTime);
                    body.contents().find(".name").val(data.name);
                    body.contents().find(".location").val(data.location);
                    body.contents().find(".name").val(data.name);
                    body.contents().find(".num").val(data.num);
                    body.contents().find(".overPrice").val(data.overPrice);
                    body.contents().find(".totalPrice").val(data.totalPrice);
                }
            });
            //layui.layer.full(index);//全屏显示
            window.sessionStorage.setItem("index", index);
            //改变窗口大小时，重置弹窗的宽高，防止超出可视区域（如F12调出debug的操作）
            $(window).on("resize", function () {
                layui.layer.full(window.sessionStorage.getItem("index"));
            })
        }


    });

</script>
</body>
</html>